package com.ruoyi.com.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.com.domain.ComUserDept;
import com.ruoyi.com.mapper.ComUserDeptMapper;
import com.ruoyi.com.service.IComUserDeptService;
import com.ruoyi.common.core.domain.OperateBasicForm;
import com.ruoyi.common.core.domain.entity.SysDept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 用户和机构关联Service业务层处理
 *
 * @author sunye
 * @date 2024-10-14
 */
@Service
public class ComUserDeptServiceImpl extends ServiceImpl<ComUserDeptMapper, ComUserDept> implements IComUserDeptService
{
    @Autowired
    private ComUserDeptMapper comUserDeptMapper;

    /**
     * 查询用户和机构关联
     *
     * @param userId 用户和机构关联主键
     * @return 用户和机构关联
     */
    @Override
    public List<SysDept> selectComUserDeptByUserId(Long userId)
    {
        return comUserDeptMapper.selectComUserDeptByUserId(userId);
    }

    /**
     * 查询用户和机构关联列表
     *
     * @param comUserDept 用户和机构关联
     * @return 用户和机构关联
     */
    @Override
    public List<ComUserDept> selectComUserDeptList(ComUserDept comUserDept)
    {
        return comUserDeptMapper.selectComUserDeptList(comUserDept);
    }

    /**
     * 新增用户和机构关联
     *
     * @param comUserDept 用户和机构关联
     * @return 结果
     */
    @Override
    public int insertComUserDept(ComUserDept comUserDept)
    {
        return comUserDeptMapper.insert(comUserDept);
    }

    /**
     * 修改用户和机构关联
     *
     * @param comUserDept 用户和机构关联
     * @return 结果
     */
    @Override
    public int updateComUserDept(ComUserDept comUserDept)
    {
        return comUserDeptMapper.updateById(comUserDept);
    }

    /**
     * 批量删除用户和机构关联
     *
     * @param userIds 需要删除的用户和机构关联主键
     * @return 结果
     */
    @Override
    public int deleteComUserDeptByUserIds(Long[] userIds)
    {
        return comUserDeptMapper.deleteComUserDeptByUserIds(userIds);
    }

    /**
     * 删除用户和机构关联信息
     *
     * @param userId 用户和机构关联主键
     * @return 结果
     */
    @Override
    public int deleteComUserDeptByUserId(Long userId)
    {
        return comUserDeptMapper.deleteComUserDeptByUserId(userId);
    }
    /**
     * 置为有效/无效用户和机构关联
     *
     */
    @Override
    public int effectiveStatus(OperateBasicForm operateBasicForm)
    {
    return comUserDeptMapper.effectiveStatus(operateBasicForm);
    }
}
